import os
import requests
#
# with open(r"./文本", "r", encoding="utf-8") as f:
#     print(f.readline(),end="")
#     print(f.readline())
#     print(f.readline())  # 读取一行,读取完后指针移到下一行,如果没有下一行,运维print()有一个end参数,默认是换行符,所以或空一行然后继续读取下一行
#     print(f.readlines())  # 读取所有行,返回一个列表,列表中的每一个元素是每一行的数据
#
#
# with open(r"./文本", "r", encoding="utf-8") as f:
#     print(f.read())  # 读取所有内容,返回一个字符串,字符串中包含所有的内容
#     print(f.readline())  # 读取完所有内容后,指针移到最后一行,再读取一行,返回一个空字符串


with open(r"./文本", "r", encoding="utf-8") as f:
    for line in f:
        print(line, end="")

with open(r"./文本", "w+", encoding="utf-8") as f:
    while True:
        line = f.readline()
        if line == "":
            break
        print(line, end="")


